<?php 
/**
 *   提货码的数据
 */
if (!function_exists('get_code'))
{
	function get_code()
	{
		$words = array('A','B','C','D','E','F','G','H','J','K','L','M','N','P','Q','R','S','T','U','V','W','X','Y','Z');
		$numbers = range(2,9);
		$valid_char = array_merge($words,$numbers);
		return $valid_char;
	}
}

/**
 *   初始化随机指针
 */
if (!function_exists('make_seed'))
{
	function make_seed()
	{
		list($usec, $sec) = explode(' ', microtime());
		return (float) $sec + ((float) $usec * 100000);
	}
}

/**
 *   取得随机数,参数为随机数的长度
 */
if (!function_exists('get_rand'))
{
	function get_rand($length)
	{
		$valid_char = get_code();
		srand(make_seed());
		$rand_index = "";
		while(strlen($rand_index) < $length)
		{
			$i = mt_rand(0,count($valid_char)-1);
			$rand_index .= $valid_char[$i];
		}
		$i = rand(0,9999);
		return $rand_index;
	}
}

?>
